package com.iretailer.report.mapper;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.iretailer.report.base.SuperMapper;
import com.iretailer.report.model.Coefficient;
import com.iretailer.report.model.CoefficientCompany;
import org.apache.ibatis.annotations.Param;

import java.util.List;


/**
 * @author Bennie
 */
public interface CoefficientMapper extends SuperMapper<Coefficient> {

    List<Coefficient> selectByZoneId(@Param("zoneId") String zoneId);

    List<Coefficient> selectByZoneIds(@Param("zoneIds") List<String> zoneIds);

    /**
     * 根据 userId 查询出 user 下的 business
     */
    List<Coefficient> selectByCompanyId(@Param("companyId") String companyId);

    /**
    /**
     * 根据 coefficientId 查询 主要用于删除 coefficient 的时候是否还有关联
     */
    List<String> selectZoneIdsById(@Param("coefficientId") String coefficientId);

    Integer deleteCoefficientByIds(@Param("ids") List<Long> ids);

    Integer deleteCoefficientZoneByCoefficientIdAndZoneId(@Param("coefficientId") String coefficientId, @Param("zoneId") String zoneId);

    /**
     * 删除 coefficientId 的所有关联
     */
    Integer deleteCoefficientZonesByCoefficientId(@Param("coefficientId") String coefficientId);

    /**
     * 向 t_camera_coefficient_zones 中插入所有关联
     */
    Integer insertCoefficientIds(@Param("coefficientId") String coefficientId, @Param("zoneIds") List<String> zoneIds);


    IPage<CoefficientCompany> selectPageCoefficientCompanyName(Page page, @Param("ew") QueryWrapper queryWrapper);

    List<String> findZoneIdsByCoefficientId(@Param(("coefficientId")) String coefficientId);
}
